﻿// Decompiled with JetBrains decompiler
// Type: TaleWorlds.MountAndBlade.View.MissionViews.SpectatorCameraView
// Assembly: TaleWorlds.MountAndBlade.View, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 61152EB8-513B-4D4A-8AC0-0D1465C6CF6C
// Assembly location: D:\steam\steamapps\common\Mount & Blade II Bannerlord\Modules\Native\bin\Win64_Shipping_Client\TaleWorlds.MountAndBlade.View.dll

using System.Collections.Generic;
using System.Linq;
using TaleWorlds.Engine;
using TaleWorlds.InputSystem;
using TaleWorlds.Library;

#nullable disable
namespace TaleWorlds.MountAndBlade.View.MissionViews
{
  public class SpectatorCameraView : MissionView
  {
    private List<MatrixFrame> _spectateCamerFrames = new List<MatrixFrame>();

    public override void OnMissionScreenInitialize()
    {
      base.OnMissionScreenInitialize();
      this.MissionScreen.SceneLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("MultiplayerHotkeyCategory"));
    }

    public override void AfterStart()
    {
      for (int index = 0; index < 10; ++index)
        this._spectateCamerFrames.Add(MatrixFrame.Identity);
      for (int index = 0; index < 10; ++index)
      {
        List<GameEntity> list = Mission.Current.Scene.FindEntitiesWithTag("spectate_cam_" + index.ToString()).ToList<GameEntity>();
        if (list.Count > 0)
          this._spectateCamerFrames[index] = list[0].GetGlobalFrame();
      }
    }
  }
}
